package com.dianning.web.action.user;

import java.util.List;

import org.apache.commons.logging.*;

import com.dianning.bean.Resume;
import com.dianning.bean.UserDetail;
import com.dianning.bean.UserInfo;
import com.dianning.bean.Visitor;
import com.dianning.comm.Constant;
import com.dianning.comm.OrderObj;
import com.dianning.comm.Util;
import com.dianning.service.InfoService;
import com.dianning.service.UserInfoService;
import com.dianning.service.VisitorService;
import com.dianning.service.web.PageList;
import com.dianning.service.web.Pages;
import com.dianning.web.action.BaseAction;
import com.dianning.web.interceptor.UserSessionAware;
import com.dianning.web.servlet.UserSession;

public class Index extends BaseAction implements UserSessionAware{

	private static final Log logger = LogFactory.getLog(Index.class);
	
	private UserInfoService userInfoService;
	private InfoService infoService;

	public UserInfoService getUserInfoService() {
		return userInfoService;
	}

	public void setUserInfoService(UserInfoService userInfoService) {
		this.userInfoService = userInfoService;
	}	

	public InfoService getInfoService() {
		return infoService;
	}

	public void setInfoService(InfoService infoService) {
		this.infoService = infoService;
	}

	private UserSession userSession;

	public UserSession getUserSession() {
		return userSession;
	}

	public void setUserSession(UserSession userSession) {
		this.userSession = userSession;
	}
	
	private UserInfo userInfo;
	private List newInfos;
	private List showInfos;
	private List validateInfos;
	private List delInfos;

	public UserInfo getUserInfo() {
		return userInfo;
	}

	public void setUserInfo(UserInfo userInfo) {
		this.userInfo = userInfo;
	}

	public List getNewInfos() {
		return newInfos;
	}

	public void setNewInfos(List newInfos) {
		this.newInfos = newInfos;
	}

	public List getShowInfos() {
		return showInfos;
	}

	public void setShowInfos(List showInfos) {
		this.showInfos = showInfos;
	}

	public List getValidateInfos() {
		return validateInfos;
	}

	public void setValidateInfos(List validateInfos) {
		this.validateInfos = validateInfos;
	}

	public List getDelInfos() {
		return delInfos;
	}

	public void setDelInfos(List delInfos) {
		this.delInfos = delInfos;
	}
	
	
	public String execute() {
		try {
			return this.executeMethod(this.getAction());
		} catch (Exception e) {
			logger.error(e);
			return ERROR;
		}
	}
	
	public String index(){
		this.setUserInfo(this.getUserInfoService().findUserInfoByUid(userSession.getUid()));
		this.setNewInfos(this.getInfoService().findInfos(-1, userSession.getUid(), -1, 1, -1, -1, "addTime", 1, 0, 10));
		this.setShowInfos(this.getInfoService().findInfos(-1, userSession.getUid(), -1, 1, 1, -1, "addTime", 1, 0, 10));
		this.setValidateInfos(this.getInfoService().findInfos(-1, userSession.getUid(), -1, 0, -1, -1, "addTime", 1, 0, 10));
		this.setDelInfos(this.getInfoService().findInfos(-1, userSession.getUid(), -1, 1, 3, -1, "addTime", 1, 0, 10));
		return SUCCESS;
	}

}
